package com.unei.scala.demo.test
import org.junit.Test;

class ListDemo {
	val list=List(1,2,3,4)

    @Test
    def testList(){
        val oneTwo=List(1,2);
        var threeFour=List(3,4);
        val ottf=oneTwo:::threeFour;
        println(oneTwo);
        println(threeFour);
        println(ottf);
        
        threeFour=1::threeFour;
        println(threeFour);
        
        threeFour.::(2);
        threeFour.foreach(s=>print(s));
    }
    
    @Test
    def testForeach(){
        println("testForeach:---------")
        list.foreach((x:Int)=>println(x))
    }
    
    @Test
    def testFilter(){
        println("testFilter--------")
    	val list2=list.filter((x:Int)=>x>1)
    	list2.foreach((x:Int)=>println(x))
    }
}